package org.androidpn.server.dao.impl;

import java.util.List;

import org.androidpn.server.dao.RoomDao;
import org.androidpn.server.entity.Room;
import org.androidpn.server.entity.Room.RoomStatus;
import org.springframework.stereotype.Repository;

/**
 * Dao room
 * 
 * @author 蔡琪
 * 
 */
@Repository("roomDao")
public class RoomDaoImpl extends BaseDaoImpl<Room, Long> implements RoomDao {

	public List<Room> getOnlineRooms() {
		String jpql = "from Room room where room.status = :roomStatus";
		List<Room> rooms = entityManager.createQuery(jpql, Room.class)
				.setParameter("roomStatus", RoomStatus.waitting)
				.getResultList();
		return rooms;
	}

}
